home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 2.8 KB | 131 lines | [TEXT/CWIE] |
- // Frame.cp
-
- #ifndef Frame_h
- #include "Frame.h"
- #endif
- #ifndef ViewMap_h
- #include "ViewMap.h"
- #endif
-
- void Frame::Draw( const ViewMap& map ) const
- {
- Rectangle inside( map.Bounds() );
- inside.Inset( thickness );
- DrawBorder( map, inside );
-
- ViewMap interiorMap( map );
- interiorMap.Set( map, inside );
-
- if ( interiorMap.Visible() )
- interior->Draw( interiorMap );
- }
-
- void Frame::GainMapping()
- {
- Rectangle inside( Owner().Bounds() );
- inside.Inset( thickness );
- interior.SetBounds( inside );
- interior.MapTo( Owner().Window() );
- }
-
- void Frame::LoseMapping()
- {
- interior.Unmap();
- }
-
- void Frame::ChangeBounds( Rectangle )
- {
- if ( Mapped() )
- {
- Rectangle inside( Owner().Bounds() );
- inside.Inset( thickness );
- interior.SetBounds( inside );
- }
- }
-
- uint16 Frame::MinimumWidth() const
- {
- uint16 width = interior->MinimumWidth();
- return ( width < maxint16 - thickness.Width() )
- ? width + thickness.Width()
- : maxint16;
- }
-
- uint16 Frame:: MinimumHeight() const
- {
- uint16 height = interior->MinimumHeight();
- return ( height < maxint16 - thickness.Height() )
- ? height + thickness.Height()
- : maxint16;
- }
-
- uint16 Frame:: MaximumWidth() const
- {
- uint16 width = interior->MaximumWidth();
- return ( width < maxint16 - thickness.Width() )
- ? width + thickness.Width()
- : maxint16;
- }
-
- uint16 Frame:: MaximumHeight() const
- {
- uint16 height = interior->MaximumHeight();
- return ( height < maxint16 - thickness.Height() )
- ? height + thickness.Height()
- : maxint16;
- }
-
- uint16 Frame:: ReasonableWidth() const
- {
- uint16 width = interior->ReasonableWidth();
- return ( width < maxint16 - thickness.Width() )
- ? width + thickness.Width()
- : maxint16;
- }
-
- uint16 Frame:: ReasonableHeight() const
- {
- uint16 height = interior->ReasonableHeight();
- return ( height < maxint16 - thickness.Height() )
- ? height + thickness.Height()
- : maxint16;
- }
-
- uint16 Frame:: BestWidth() const
- {
- uint16 width = interior->BestWidth();
- return ( width < maxint16 - thickness.Width() )
- ? width + thickness.Width()
- : maxint16;
- }
-
- uint16 Frame:: BestHeight() const
- {
- uint16 height = interior->BestHeight();
- return ( height < maxint16 - thickness.Height() )
- ? height + thickness.Height()
- : maxint16;
- }
-
- uint16 Frame::BestWidth( uint16 bound ) const
- {
- if ( bound < thickness.Width() )
- return bound;
-
- uint16 width = interior->BestWidth( bound - thickness.Width() );
- return ( width < maxint16 - thickness.Width() )
- ? width + thickness.Width()
- : maxint16;
- }
-
- uint16 Frame::BestHeight( uint16 bound ) const
- {
- if ( bound < thickness.Height() )
- return bound;
-
- uint16 width = interior->BestHeight( bound - thickness.Height() );
- return ( width < maxint16 - thickness.Height() )
- ? width + thickness.Height()
- : maxint16;
- }
-